#include<iostream>
#include<string>
int day[] = { 0,31,29,31,30,31,30,31,31,30,31,30,31 };
using namespace std;
int main()
{
	int n, m,count = 0;
	cin >> n >> m;
	for (int i = 1; i <= 12; i++)
	{
		for (int j = 1; j <= day[i]; j++)
		{
			int k = j % 10 * 1000 + j / 10 * 100 + i % 10 * 10 + i / 10;
			if (n <=( k * 10000 + i * 100 + j) && m >= (k * 10000 + i * 100 + j)) count++;
		}
	}
	cout << count << endl;
	return 0;
}
//#include<iostream>
//const int N = 1e5 + 10;
//int day[] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
//using namespace std;
//int main()
//{
//	int n, m,count = 0;
//	cin >> n >> m;
//	for (int i = 1; i <= 12; i++)
//	{
//		for (int j = 1; j <= day[i]; j++)
//		{
//			int k = j % 10 * 1000 + j / 10 * 100 + i % 10 * 10 + i / 10;
//			if (n <= (k * 10000 + i * 100 + j) && (k * 10000 + i * 100 + j) <= m) count++;
//		}
//	}
//	cout << count << endl;
//	return 0;
//}